/*
 *--------------------------------------------------------------------------
 *   Battlefield - A Realtime Network Multiplayer Game
 *   =======================================================
 *   Developed by Group D02 - 2009/2010 Semester 4 - CS2103
 *     Harry Nguyen Duy Hoang <nnduyhoang@yahoo.co.uk>
 *     Kent Chng Siang Rong <fivefootway@gmail.com>
 *     Lim Yong Peng <limpeng1986@gmail.com>
 *     Loh Xiankun <u0807185@nus.edu.sg>
 *   Instructed by
 *     Dr. Damith C.Rajapakse <damith@gmail.com>
 *   =======================================================
 *   $Id: FormateImage.java 570 2010-07-25 20:56:59Z Harry $
 *   $LastChangedDate: 2010-07-25 20:56:59 +0000 (Sun, 25 Jul 2010) $
 *   $LastChangedBy: Harry $
 *--------------------------------------------------------------------------
 */
package battlefield.util;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import javax.swing.ImageIcon;

/**
 *
 * @author xiankun
 */
public class FormateImage {

    public FormateImage() {
    }

    public ImageIcon resizeImage(ImageIcon imgSrc, int width, int height) {
        BufferedImage drawImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = drawImage.createGraphics();
        g2.drawImage(imgSrc.getImage(), 0, 0, width, height, (ImageObserver) this);
        return new ImageIcon(drawImage);
    }
}
